package com.iknow.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.iknow.util.Loger;
import com.iknow.util.SystemUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class WebViewActivity extends Activity
{
  private String mVideoSrc;
  private WebView mVideoView;

  private void callHiddenWebViewMethod(String paramString)
  {
    if (this.mVideoView != null);
    try
    {
      WebView.class.getMethod(paramString, new Class[0]).invoke(this.mVideoView, new Object[0]);
      return;
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      Loger.i("No such method: " + paramString, localNoSuchMethodException.toString());
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      Loger.i("Illegal Access: " + paramString, localIllegalAccessException.toString());
    }
    catch (InvocationTargetException localInvocationTargetException)
    {
      Loger.d("Invocation Target Exception: " + paramString, localInvocationTargetException.toString());
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(2130903135);
    this.mVideoSrc = getIntent().getStringExtra("flash");
    String str = String.valueOf(2 * SystemUtil.getDisplayWidth() / 3);
    String.valueOf(SystemUtil.getDisplayHeight());
    this.mVideoSrc = "<embed src=\"" + this.mVideoSrc + "\" quality=\"high\" width=\"" + str + "\" height=\"" + 400 + "\" align=\"middle\" allowScriptAccess=\"always\" mode=\"transparent\" type=\"application/x-shockwave-flash\"></embed>";
    this.mVideoSrc = "<html><body>" + this.mVideoSrc + "</body></html>";
    this.mVideoView = ((WebView)findViewById(2131296589));
    WebSettings localWebSettings = this.mVideoView.getSettings();
    localWebSettings.setJavaScriptEnabled(true);
    localWebSettings.setPluginsEnabled(true);
    this.mVideoView.loadData(this.mVideoSrc, "text/html", "utf-8");
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool;
    if ((paramInt == 4) && (this.mVideoView.canGoBack()))
    {
      this.mVideoView.goBack();
      bool = true;
    }
    while (true)
    {
      return bool;
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  protected void onPause()
  {
    super.onPause();
    this.mVideoView.pauseTimers();
    if (isFinishing())
    {
      this.mVideoView.loadUrl("about:blank");
      setContentView(new FrameLayout(this));
    }
    callHiddenWebViewMethod("onPause");
  }

  protected void onResume()
  {
    super.onResume();
    this.mVideoView.resumeTimers();
    callHiddenWebViewMethod("onResume");
  }

  protected void onStart()
  {
    super.onStart();
  }

  private class WebViewClientDemo extends WebViewClient
  {
    public boolean shouldOverrideUrlLoading(, String paramString)
    {
      paramWebView.loadUrl(paramString);
      return true;
    }
  }
}